#ifndef __STORMWIDGET_CONFIGMANAGE_CSETUPTHREAD_SETUPTHREAD_H
#define __STORMWIDGET_CONFIGMANAGE_CSETUPTHREAD_SETUPTHREAD_H

#include "SingleThread.h"
#include "ITaskEvent.h"
#include "CommonDefine.h"
#include "AutoLock.h"
#include "PostCount.h"
#include <vector>

typedef struct
{
	CStdString strTaskNo;
	CStdString strPath;
}SETUPSTRUCT;

class CSetupThread:public CSingleThread
{
public:
	CSetupThread(void);
	virtual ~CSetupThread(void);
	UINT __stdcall DefThreadProc();
	void Start(ITaskEvent* pCallBack,CPostCount* pPostCount);
	void Cancel();
	void Pause();
	void Resume();
	void AddSetupTask(CStdString strTaskNo,CStdString strPath);
	BOOL GetSetupTask(SETUPSTRUCT& setup);
	BOOL RunExe(CStdString strPath);
	BOOL CheckFileExist(LPCTSTR pstrFileName, BOOL bCanZero);
private:
	HANDLE m_ExitEvent;
	std::vector<SETUPSTRUCT> m_vSetupList;
	CCritSec m_csSetupList;
	ITaskEvent* m_pCallBack;
	int m_nSetupTimeout;
	bool m_bPause;
	CPostCount* m_pPostCount;
};

#endif //__STORMWIDGET_CONFIGMANAGE_CSETUPTHREAD_SETUPTHREAD_H
